package com.myHospital.test;

import java.util.List;

import com.myHospital.dao.UserDao;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.myHospital.biz.UserBiz;
import com.myHospital.entity.User;

public class Usertest {
    ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
    UserBiz userBiz = (UserBiz) context.getBean("userBiz");
    UserDao userDao=(UserDao) context.getBean("userDao");
    @Test
    public void SearchUser() {
       List<User> users= userBiz.SearchUser("丁",null,null,0,5);
        users.forEach(s-> System.out.println(s.getName()));
    }
    @Test
    public void register(){
        User user =new User();
        user.setAge(20);
        user.setName("hehe");
        user.setPassword("123");
        user.setSite("广州");
        user.setSex('男');
        user.setPhone("1234567890");
        System.out.println(userBiz.register(user));
    }
    @Test
    public void getById(){
        User user=userBiz.getById(1);
        System.out.println(user.getName());
    }
    @Test
    public void login(){
        User user=userDao.login("丁六","123");
        System.out.println(user.getName());
    }
}
